const express = require('express')
const router = express.Router()

// 导入用户数据校验的中间件
const expressJoi = require('@escook/express-joi')
const { regReguster,regRegusterEmail,regLogin } = require('../check/user')

// 导入用户路由处理函数模块
const router_method = require('../router_method/userRegister')
const router_Login = require('../router_method/userLogin')

// 注册模块
router.post('/register',expressJoi(regReguster),router_method.userRegister)
router.post('/emailCheck',expressJoi(regRegusterEmail),router_method.userEmailCheck)
router.post('/sendAgain',expressJoi(regRegusterEmail),router_method.sendAgain)
router.post('/codeCheck',router_method.userCodeCheck)

// 登录模块
router.post("/userLogin",expressJoi(regLogin),router_Login.userLogin)
router.post("/queryUserPic",router_Login.queryUserPic)
router.post("/loginCodeCheck",router_Login.loginCodeCheck)
router.post("/refreshCode",router_Login.refreshCode)
router.post("/checkCodeLogin",router_Login.checkCodeLogin)

module.exports = router